package com.cqrt.util;

import com.cqrt.dto.ExportPlanExcelDTO;
import com.hustcad.plm.rpm.model.dto.active.TyppmActiveTreeDTO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author：lotus
 * @DATE: 2025/7/6 16:26
 */
//比较后插入新集合
public  class CompareResult {

    private List<ExportPlanExcelDTO> exportPlanExcelDTOList = new ArrayList<>();

    // Getters
    public void setAddedNodes(TyppmActiveTreeDTO typpmActiveTreeDTO) {

        ExportPlanExcelDTO exportPlanExcelDTO = new ExportPlanExcelDTO();
        exportPlanExcelDTO.setLevel(typpmActiveTreeDTO.getOutLineNumber());
        exportPlanExcelDTO.setWbsCode(typpmActiveTreeDTO.getWbs());
        exportPlanExcelDTO.setPrincipalAgain(typpmActiveTreeDTO.getOwnerName());

        exportPlanExcelDTO.setPlanNameAgain(typpmActiveTreeDTO.getName());
        exportPlanExcelDTO.setPlanStartTimeAgain(typpmActiveTreeDTO.getStartDate());
        exportPlanExcelDTO.setPlanEndTimeAgain(typpmActiveTreeDTO.getFinishDate());
        exportPlanExcelDTO.setPredecessorTaskAgain(typpmActiveTreeDTO.getBeforeLineNumber());
        exportPlanExcelDTO.setExecutedStatus(typpmActiveTreeDTO.getExecutedStatus());
        this.exportPlanExcelDTOList.add(exportPlanExcelDTO);

    }

    public void setDeletedNodes(TyppmActiveTreeDTO typpmActiveTreeDTO) {


        ExportPlanExcelDTO exportPlanExcelDTO = new ExportPlanExcelDTO();
        exportPlanExcelDTO.setLevel(typpmActiveTreeDTO.getOutLineNumber());
        exportPlanExcelDTO.setWbsCode(typpmActiveTreeDTO.getWbs());
        exportPlanExcelDTO.setPrincipal(typpmActiveTreeDTO.getOwnerName());

        exportPlanExcelDTO.setPlanName(typpmActiveTreeDTO.getName());
        exportPlanExcelDTO.setPlanStartTime(typpmActiveTreeDTO.getStartDate());
        exportPlanExcelDTO.setPlanEndTime(typpmActiveTreeDTO.getFinishDate());
        exportPlanExcelDTO.setPredecessorTask(typpmActiveTreeDTO.getBeforeLineNumber());
        exportPlanExcelDTO.setExecutedStatus(typpmActiveTreeDTO.getExecutedStatus());
        this.exportPlanExcelDTOList.add(exportPlanExcelDTO);

    }

    public void setOldAndNewFit(TyppmActiveTreeDTO typpmActiveTreeDTO, TyppmActiveTreeDTO typpmActiveTreeDTONew) {

        ExportPlanExcelDTO exportPlanExcelDTO = new ExportPlanExcelDTO();
        exportPlanExcelDTO.setLevel(typpmActiveTreeDTO.getOutLineNumber());
        exportPlanExcelDTO.setWbsCode(typpmActiveTreeDTO.getWbs());
        exportPlanExcelDTO.setPrincipal(typpmActiveTreeDTO.getOwnerName());
        exportPlanExcelDTO.setPlanName(typpmActiveTreeDTO.getName());
        exportPlanExcelDTO.setPlanStartTime(typpmActiveTreeDTO.getStartDate());
        exportPlanExcelDTO.setPlanEndTime(typpmActiveTreeDTO.getFinishDate());
        exportPlanExcelDTO.setPredecessorTask(typpmActiveTreeDTO.getBeforeLineNumber());

        exportPlanExcelDTO.setPrincipalAgain(typpmActiveTreeDTONew.getOwnerName());
        exportPlanExcelDTO.setPlanNameAgain(typpmActiveTreeDTONew.getName());
        exportPlanExcelDTO.setPlanStartTimeAgain(typpmActiveTreeDTONew.getStartDate());
        exportPlanExcelDTO.setPlanEndTimeAgain(typpmActiveTreeDTONew.getFinishDate());
        exportPlanExcelDTO.setPredecessorTaskAgain(typpmActiveTreeDTONew.getBeforeLineNumber());
        exportPlanExcelDTO.setExecutedStatus(typpmActiveTreeDTO.getExecutedStatus());
        this.exportPlanExcelDTOList.add(exportPlanExcelDTO);

    }

    public void setOldAndNewNotFit(TyppmActiveTreeDTO typpmActiveTreeDTO, TyppmActiveTreeDTO typpmActiveTreeDTONew) {

        this.setAddedNodes(typpmActiveTreeDTO);
        this.setDeletedNodes(typpmActiveTreeDTONew);

    }


    public List<ExportPlanExcelDTO> getExportPlanExcelDTOList() {

        return this.exportPlanExcelDTOList;
    }


}